#!/bin/bash # Description : This script moves the content from the source to the destination location using 'mv -fr' command. # # Returns : 0 if successfully moved. # 1 if there is an error failure in moving. # 2 if there are invalid arguments. # # Usage : sh MoveFiles.sh ${src_path} ${dest_path} # # Example : sh MoveFiles.sh "/home/user/old" "/home/user/new" # # Maintainer : ManageEngine Desktop Central errorCode=2 euid=$(id -u) for i in 1 do #check that the number of arguments are valid if [ $# -ne 2 ] then echo "Incorrect Usage : Arguments mismatch." echo "Usage : sh MoveFiles.sh \${src_path} \${dest_path}" break fi errorCode=0 sourcePath=$1 destPath=$2 #move the file contens to destination path mv -f $sourcePath $destPath if [ $? -eq 0 ] then echo "Moved : $sourcePath to $destPath" else #echo "Could not remove : $pathToRemove" errorCode=1 fi done errorFunc(){ return $errorCode } errorFunc